home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1984 May
/
1984-05.d64
/
joystick control
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
3KB
|
104 lines
15 rem * chase and tag *
40 poke 53280,4 :poke 53281,14 :print "" :clr :co=54272:goto 700
50 rem *** indirect address registers ***
55 poke 52254,1 :poke 52246,2 :poke 52247,42 :poke 52245,82 :poke 52253,81
60 poke 52249,80 :poke 52251,40 :poke 52250,0 :poke 52255,41
65 poke 52126,1 :poke 52118,2 :poke 52119,42 :poke 52117,82 :poke 52125,81
70 poke 52121,80 :poke 52123,40 :poke 52122,0 :poke 52127,41
100 rem *** player movement with joystick ***
110 r = 1422 :l = 1385 :p = 0
120 poke r,81:poker+co,0:poke l,102:pokel+co,0
125 p = p+1
130 if p = 100 then goto 310
140 x = peek(56321)+52000
145 if x < 52245 then goto 140
150 m = peek(x)-41
160 y = peek(56320)+52000
165 if y < 52117 then goto 160
170 n = peek(y)-41
180 c = (r+m - 1063) / 40 :if c - int(c) = 0 then m = 0 :goto 210
190 g = (r+m - 1064) / 40 :if g - int(g) = 0 then m = 0 :goto 210
200 if r+m < 1063 or r+m > 1822 then m = 0
210 poke r,32:poker+co,0:r = r+m
220 poke r,81:poker+co,0
225 if t = 1 and r = l then goto 310
230 h = (l+n - 1063) / 40 :if h - int(h) = 0 then n = 0 :goto 260
240 b = (l+n - 1064) / 40 :if b - int(b) = 0 then n = 0 :goto 260
250 if l+n < 1063 or l+n > 1822 then n = 0
260 poke l,32 :pokel+co,0:l = l+n
270 poke l,102:pokel+co,0
275 if t = 0 and r = l then goto 310
280 if p = 80 then poke 53281,12
290 goto 125
300 rem *** the explosion ***
310 for b = 1 to 6
320 for a = 0 to 15 :poke 53281,a :next a
330 next b
340 poke l,32:pokel+co,0:poke r,32:poker+co,0
400 rem *** resetting the playing field and keeping score ***
410 poke 53281,1 :poke 1422,81:poke 1422+co,0:poke 1385,102:poke1385+co,0
420 if t = 0 and p = 100 then goto 610
430 if t = 1 and p < 100 then goto 610
500 rem *** updating the left players score ***
510 e = e+1
520 if e = 58 and f = 49 then goto 1300
530 if e = 58 then f = 49 :poke 1945,f:poke1945+co,0
540 if e = 58 then e = 48
550 poke 1976,9:poke1976+co,0:poke 1977,20:poke1977+co,0
560 poke 1946,e:poke1946+co,0:poke 1949,32:poke1949+co,0
565 poke 1950,32:poke1950+co,0:t = 1 :goto 110
600 rem *** updating the right players score ***
610 d = d+1
620 if d = 58 and qg = 49 then goto 1300
630 if d = 58 then qg = 49 :poke 1980,qg:poke1980+co,0
640 if d = 58 then d = 48
650 poke 1949,9:poke1949+co,0:poke 1950,20:poke1950+co,0
660 poke 1981,d:poke1981+co,0:poke 1976,32
665 poke 1976,32 :poke1976+co,0:poke 1977,32 :poke1977+co,0:t=0:goto 110
700 rem *** entering the players initials ***
710 poke53281,0:print "[147]":poke53281,1
720 print "[144]enter the left players 3 initials"
725 print"";
730 for kl = 1 to 3
735 getk$:ifk$=""then735
737 ifk$>"z"ork$<"a"then735
739 printk$;
740 im$(kl)=k$:next kl
750 poke53281,0:print "[147]":poke53281,1
760 print "enter the right players 3 initials"
765 print"";
770 for kr = 1 to 3
775 getk$:ifk$=""then775
777 ifk$>"z"ork$<"a"then775
779 printk$;
780 in$(kr)=k$:next kr
800 poke53281,0:print "[147]":poke53281,1
810 e = 48 :d = 48 :t = 0 :s = 1024 :v = 1824 :z = 1863
900 rem *** title on screen ***
910 data 34,32,3,8,1,19,5,32,1,14,4,32,20,1,7,32,34
920 for tt = 1 to 17 :read td :poke 1874+tt,td :next tt
1000 rem *** drawing the playing field ***
1010 poke s,108:pokes+co,0:for b = 1 to 38 :poke s+b,121:pokes+b+co,0:next b
1020 poke s+b,123 :for b = 79 to 799 step 40 :poke s+b,117:pokes+b+co,0:next b
1030 poke z,126 :for b = 38 to 1 step -1 :poke v+b,120:pokev+b+co,0:next b
1040 poke v,124:pokev+co,0:for b = 760 to 40 step -40 :poke s+b,118 :next b
1050 :
1100 rem *** initializing left players score ***
1110 le = 1905
1120 for kl = 1 to 3 :x = asc(im$(kl)) :poke le,x-64 :le = le+1 :next kl
1130 poke 1949,9:poke1949+co,0:poke 1950,20:poke1949+co,0:poke 1946,e
1135 poke1946+co,0
1200 rem *** initializing right players score ***
1210 re = 1940
1220 for kr = 1 to 3 :x = asc(in$(kr)) :poke re,x-64 :re = re+1 :next kr
1230 poke 1981,d:poke1981+co,0:goto 55
1300 poke53281,0:print "[147]":poke53281,1
1310 print " if you want to play another game"
1320 print " press 'y'[146] or 'n'[146].":poke198,0
1330 get an$:if an$="" then 1330
1340 if an$="n" then goto 1400
1350 if an$="y" then 40
1360 goto1330
1400 poke53281,0:print "[147]" :poke53281,1:print " bye"
1410 end